package com.fg.cloud.manager.service.factory.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fg.cloud.common.PageUtils;
import com.fg.cloud.manager.entry.BaseEntity;
import com.fg.cloud.manager.entry.factory.FactoryPaymentEntity;
import com.fg.cloud.manager.mapper.BaseMapper;
import com.fg.cloud.manager.mapper.factory.FactoryPaymentMapper;
import com.fg.cloud.manager.service.BaseServiceImpl;
import com.fg.cloud.manager.service.factory.FactoryPaymentService;

/**
 * @author liushengchao
 * @Description: 支付方式接口实现 
 * @date 2017年6月15日上午11:43:08
 *
 */
@Service
public class FactoryPaymentServiceImpl extends BaseServiceImpl implements FactoryPaymentService{

	@Autowired
	private FactoryPaymentMapper paymentMapper ;
	
	protected <T extends BaseEntity> BaseMapper getBaseMapper() {
		return paymentMapper;
	}

	@Override
	public void findList(PageUtils<FactoryPaymentEntity> pageinfo) {
		long total = paymentMapper.filterCount(pageinfo.getCondition());
		pageinfo.setTotal(total);
		if (total > 0) {
			pageinfo.setData(paymentMapper.findList(pageinfo));
		} else {
			pageinfo.setData(new ArrayList<FactoryPaymentEntity>());
		}
		
	}

	@Override
	public List<FactoryPaymentEntity> findByFacId(Long facId, Integer paymentType) {
		return paymentMapper.selectByFacId(facId, paymentType);
	}

	@Override
	public FactoryPaymentEntity find(Long id, Long facId) {
		return paymentMapper.find(id, facId);
	}

}
